const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('sunnyUserOauth', {
    id: {
      type: DataTypes.BIGINT,
      allowNull: false,
      primaryKey: true,
      comment: "主键"
    },
    tenantId: {
      type: DataTypes.STRING(12),
      allowNull: true,
      comment: "租户ID",
      field: 'tenant_id'
    },
    uuid: {
      type: DataTypes.STRING(64),
      allowNull: true,
      comment: "第三方系统用户ID"
    },
    userId: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "用户ID",
      field: 'user_id'
    },
    username: {
      type: DataTypes.STRING(32),
      allowNull: true,
      comment: "账号"
    },
    nickname: {
      type: DataTypes.STRING(64),
      allowNull: true,
      comment: "用户名"
    },
    avatar: {
      type: DataTypes.STRING(1000),
      allowNull: true,
      comment: "头像"
    },
    blog: {
      type: DataTypes.STRING(50),
      allowNull: true,
      comment: "应用主页"
    },
    company: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "公司名"
    },
    location: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "地址"
    },
    email: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "邮件"
    },
    remark: {
      type: DataTypes.STRING(255),
      allowNull: true,
      comment: "备注"
    },
    gender: {
      type: DataTypes.STRING(16),
      allowNull: true,
      comment: "性别"
    },
    source: {
      type: DataTypes.STRING(16),
      allowNull: true,
      comment: "来源"
    },
    createUser: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "创建人",
      field: 'create_user'
    },
    createTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "创建时间",
      field: 'create_time'
    },
    updateUser: {
      type: DataTypes.BIGINT,
      allowNull: true,
      comment: "更新人",
      field: 'update_user'
    },
    updateTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "更新时间",
      field: 'update_time'
    },
    deletedTime: {
      type: DataTypes.DATE,
      allowNull: true,
      comment: "删除时间",
      field: 'deleted_time'
    }
  }, {
    sequelize,
    tableName: 'sunny_user_oauth',
    timestamps: true,
    createdAt: 'createTime',
    updatedAt: 'updateTime',
    deletedAt: 'deleteTime',
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "id" },
        ]
      },
    ]
  });
};
